What is eslint-formatter-pretty?
eslint-formatter-pretty is an npm package that provides a user-friendly, visually appealing formatter for ESLint. It enhances the readability of ESLint output by organizing and styling the information in a more digestible format.
What are eslint-formatter-pretty's main functionalities?
Pretty Formatting
This feature allows you to use the 'pretty' formatter in your ESLint configuration. It formats the ESLint output in a visually appealing way, making it easier to read and understand.
module.exports = {
"extends": "eslint:recommended",
"formatter": "pretty"
};
Other packages similar to eslint-formatter-pretty
eslint-formatter-friendly
eslint-formatter-friendly is another formatter for ESLint that focuses on providing a more readable and user-friendly output. It highlights errors and warnings in a clear and concise manner, similar to eslint-formatter-pretty.
eslint-formatter-codeframe
eslint-formatter-codeframe is a formatter that uses Babel's code frame to display ESLint results. It provides a detailed and structured output, showing the exact location of errors and warnings in the code, which can be very helpful for debugging.
eslint-formatter-table
eslint-formatter-table formats ESLint results into a table format. This can be useful for quickly scanning through errors and warnings, as the tabular format organizes the information in a structured way, making it easy to spot issues.
eslint-formatter-pretty
Pretty formatter for ESLint
Highlights
- Pretty output.
- Sorts results by severity.
- Stylizes inline codeblocks in messages.
- Command-click a rule ID to open its docs.
- Command-click a header to reveal the first error in your editor. (iTerm-only)
Install
$ npm install --save-dev eslint-formatter-pretty
Usage
Nothing to do. It's the default formatter.
ESLint CLI
$ eslint --format=pretty file.js
grunt.initConfig({
eslint: {
target: ['file.js'].
options: {
format: 'pretty'
}
}
});
grunt.loadNpmTasks('grunt-eslint');
grunt.registerTask('default', ['eslint']);
const gulp = require('gulp');
const eslint = require('gulp-eslint');
gulp.task('lint', () =>
gulp.src('file.js')
.pipe(eslint())
.pipe(eslint.format('pretty'))
);
module.exports = {
entry: ['file.js'],
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'eslint-loader',
options: {
formatter: require('eslint-formatter-pretty')
}
}
]
}
};
Tips
In iTerm, Command-click the filename header to open the file in your editor.
In terminals with support for hyperlinks, Command-click the rule ID to open its docs.